<%@page import="com.blockchain.console.servlets.content.fwzc.UpdateFwzc"%>
<%@page import="com.blockchain.common.enums.ServiceType"%>
<%@page import="com.blockchain.variables.FileType"%>
<%@page import="com.blockchain.console.servlets.upload.Upload"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html >
<head> 
<%@include file="/WEB-INF/include/meta.jsp"%>
<%@include file="/WEB-INF/include/style.jsp"%>
</head>
<body>
<%
	CURRENT_CATEGORY = "NRGL";
	CURRENT_SUB_CATEGORY = "FWZC";
	ServiceType type=(ServiceType)request.getAttribute("type");
%>
<%@include file="/WEB-INF/include/header.jsp"%> 
<div class="w_main">
<div class="main clearfix">
    <div class="wrap">
        <div class="r_main">
            <div class="home_main">
            	<div class="box box1 mb15">
            	<div class="atil">
                    	<h3>服务支持</h3>
                  	</div>
                				  <div class="newsbox">
				                  <div class="til">
				                   <div class="Menubox">
				                     <ul>
				                     <%
	                                  		for (ServiceType is : ServiceType.values()) {
	                                  	%>
	                                  	<li <%if(StringHelper.isEmpty(request.getParameter("type"))&&is.name().equals(ServiceType.SWHZ.toString())){%> class="hover"<%}%><%if(is.name().equals(request.getParameter("type"))){%> class="hover" <%}%>><a href="<%=controller.getURI(request, UpdateFwzc.class)%>?type=<%=is.name()%>"   ><%=is.getName()%></a></li>
										<%
											}
										%>
				                     </ul>
				                    </div>     
				                  </div>
				                  </div>
                    <div class="con">
                    <div class="clear"></div>
                    <%
                    	String content = ObjectHelper.convert(request.getAttribute("content"), String.class);
                    	String contentEn = ObjectHelper.convert(request.getAttribute("contentEn"), String.class);
                    	String contentTw = ObjectHelper.convert(request.getAttribute("contentTw"), String.class);
                    %>
                    <form action="<%=controller.getURI(request, UpdateFwzc.class)%>"  method="post" name="example" onsubmit="return onSubmit();">
                     <input name="type" type="hidden" value="<%=type%>">
                     <ul class="cell xc_jcxx ">
                     <li>
                        <div class="til"><span class="red">&nbsp;</span></div>
                        <div class="info orange">
                        <%StringHelper.filterHTML(out, controller.getPrompt(request, response, PromptLevel.ERROR));%>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <div class="til"><span class="red">*</span>内容编辑：</div>
                        <div class="info orange">
                        	 <textarea class="ta_content" name="content" cols="100" rows="8" style="width:700px;height:500px;visibility:hidden;"><%StringHelper.format(out, content,fileStore);%></textarea>
                       		 <p id="errorContent">&nbsp;</p>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <li <% if(!isMultiLang){ %>style="display:none"<% } %>>
                        <div class="til"><span class="red">*</span>内容(英文)编辑：</div>
                        <div class="info orange">
                        	 <textarea class="ta_content" name="contentEn" cols="100" rows="8" style="width:700px;height:500px;visibility:hidden;"><%StringHelper.format(out, contentEn,fileStore);%></textarea>
                       		 <p id="errorContentEn">&nbsp;</p>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <%-- <li <% if(!isMultiLang){ %>style="display:none"<% } %>>
                        <div class="til"><span class="red">*</span>内容(繁体)编辑：</div>
                        <div class="info orange">
                        	 <textarea class="ta_content" name="contentTw" cols="100" rows="8" style="width:700px;height:500px;visibility:hidden;"><%StringHelper.format(out, contentTw,fileStore);%></textarea>
                       		 <p id="errorContentTw">&nbsp;</p>
                        </div>
                        <div class="clear"></div>
                    </li> --%>
               		</ul>
                    <div class="tc w220 pt20">
                    <input type="submit" class="btn4 mr30" value="确认" /></div>
                	<div class="clear"></div>
                    </form>
                    <div class="clear"></div>                    
                  </div>
                </div>
              <div class="box2 clearfix"></div>
            </div>
        </div>   
    </div>
	<%@include file="/WEB-INF/include/left.jsp"%>
</div>
</div>
<%@include file="/WEB-INF/include/footer.jsp"%>
<%@include file="/WEB-INF/include/script.jsp"%>
<%@include file="/WEB-INF/include/kindeditor.jsp" %>
	<script>
		var contentOk = function() {
			$("#errorContent").removeClass("red");
			$("#errorContent").html("&nbsp;");
			<% if(isMultiLang) { %>
			$("#errorContentEn").removeClass("red");
			$("#errorContentEn").html("&nbsp;");
			/* $("#errorContentTw").removeClass("red");
			$("#errorContentTw").html("&nbsp;"); */
			<% } %>
		};
		var contentNotOk = function() {
			$("#errorContent").addClass("red");
			$("#errorContent").html("内容不能为空");
			<% if(isMultiLang) { %>
			$("#errorContentEn").addClass("red");
			$("#errorContentEn").html("内容不能为空");
			/* $("#errorContentTw").addClass("red");
			$("#errorContentTw").html("内容不能为空"); */
			<% } %>
		};
		var editor1;
		KindEditor.ready(function(K) {
			editor1 = K.create('.ta_content', {
				uploadJson : '<%=controller.getURI(request, Upload.class)%>?type=<%=FileType.ARTICLE_ATTACHMENT.ordinal()%>',
				allowFileManager : false,
				formatUploadUrl: false,
				afterBlur:function(){
					this.sync();
					if(this.count('text')=='')
					{
						contentNotOk();
					}
					else
					{
						contentOk();
					}
				}
			});
			prettyPrint();
		});
		
		function onSubmit()
		{
			if(editor1.count('text')=='')
			{
				contentNotOk();
				return false;
			}
			else
			{
				contentOk();
				return true;
			}
		}
	</script>
</body>
</html>